﻿using System;
using UnityEngine;

namespace UniRx.Triggers
{
	// Token: 0x02000446 RID: 1094
	[DisallowMultipleComponent]
	public class ObservableTrigger2DTrigger : ObservableTriggerBase
	{
		// Token: 0x060016FE RID: 5886 RVA: 0x00062B2F File Offset: 0x00060F2F
		private void OnTriggerEnter2D(Collider2D other)
		{
			if (this.onTriggerEnter2D != null)
			{
				this.onTriggerEnter2D.OnNext(other);
			}
		}

		// Token: 0x060016FF RID: 5887 RVA: 0x00062B48 File Offset: 0x00060F48
		public IObservable<Collider2D> OnTriggerEnter2DAsObservable()
		{
			Subject<Collider2D> result;
			if ((result = this.onTriggerEnter2D) == null)
			{
				result = (this.onTriggerEnter2D = new Subject<Collider2D>());
			}
			return result;
		}

		// Token: 0x06001700 RID: 5888 RVA: 0x00062B70 File Offset: 0x00060F70
		private void OnTriggerExit2D(Collider2D other)
		{
			if (this.onTriggerExit2D != null)
			{
				this.onTriggerExit2D.OnNext(other);
			}
		}

		// Token: 0x06001701 RID: 5889 RVA: 0x00062B8C File Offset: 0x00060F8C
		public IObservable<Collider2D> OnTriggerExit2DAsObservable()
		{
			Subject<Collider2D> result;
			if ((result = this.onTriggerExit2D) == null)
			{
				result = (this.onTriggerExit2D = new Subject<Collider2D>());
			}
			return result;
		}

		// Token: 0x06001702 RID: 5890 RVA: 0x00062BB4 File Offset: 0x00060FB4
		private void OnTriggerStay2D(Collider2D other)
		{
			if (this.onTriggerStay2D != null)
			{
				this.onTriggerStay2D.OnNext(other);
			}
		}

		// Token: 0x06001703 RID: 5891 RVA: 0x00062BD0 File Offset: 0x00060FD0
		public IObservable<Collider2D> OnTriggerStay2DAsObservable()
		{
			Subject<Collider2D> result;
			if ((result = this.onTriggerStay2D) == null)
			{
				result = (this.onTriggerStay2D = new Subject<Collider2D>());
			}
			return result;
		}

		// Token: 0x06001704 RID: 5892 RVA: 0x00062BF8 File Offset: 0x00060FF8
		protected override void RaiseOnCompletedOnDestroy()
		{
			if (this.onTriggerEnter2D != null)
			{
				this.onTriggerEnter2D.OnCompleted();
			}
			if (this.onTriggerExit2D != null)
			{
				this.onTriggerExit2D.OnCompleted();
			}
			if (this.onTriggerStay2D != null)
			{
				this.onTriggerStay2D.OnCompleted();
			}
		}

		// Token: 0x04000CD2 RID: 3282
		private Subject<Collider2D> onTriggerEnter2D;

		// Token: 0x04000CD3 RID: 3283
		private Subject<Collider2D> onTriggerExit2D;

		// Token: 0x04000CD4 RID: 3284
		private Subject<Collider2D> onTriggerStay2D;
	}
}
